<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>password_manager</title>
<link rel="stylesheet" href="/networkforum/css/user_info.css" />

<style type="text/css">
	h5{
		width:150px;
		margin:5px 0px 5px 0px;
	}
	input{
		margin:5px 0px 5px 0px;		
	}
	span{
		padding-left: 5px;
		font-size: 12px;
		color: red;
		line-height: 35px;
		vertical-align: bottom;
	}
</style>
<script type="text/javascript">
function check(){
	var ps1 = document.getElementById("password1").value;
	var ps2 = document.getElementById("password2").value;
	var notice = document.getElementById("passwordNotice");
	if(ps1 != ps2){
		notice.innerHTML = "两次密码输入不正确";
		return false;
	}else{
		notice.innerHTML = "";
		return true;
	}
}
function handlBack(){
		var hb = document.getElementById("handleBack");
		with(hb.style){
			display = "";
			border = "none";
		}
		document.getElementById("form").reset();
}
function checkPassword(){
	var oldPassword = document.getElementById("oldPassword").value;
	var myajax = getByAjax();
	myajax.init(null,"get",true);
	myajax.get("/networkforum/user/check_password.do?oldPassword="+oldPassword,function(d){
		var notice = document.getElementById("oldPasswordNotice");
		if(d == "false"){
			notice.innerHTML = "密码错误，修改将不会成功！";
			notice.style.color = "red";
		}
		else{
			notice.innerHTML = "密码正确，可以进行修改密码！";
			notice.style.color = "green";
		}
	});
	myajax = null;
}
</script>
</head>
<body>
	<h2>修改密码</h2>
	<form id="form" action="/networkforum/user/change_password.do" target="handleBack" method="get" onsubmit="return check();">
    	<h5>旧密码：</h5>
        <input onblur="checkPassword();" id="oldPassword" name="oldPassword" type="text" /><span id="oldPasswordNotice"></span>
        <div class="clear"></div>
        <h5>新密码：</h5>
        <input id="password1" name="password" type="password" />
        <div class="clear"></div>
        <h5>再次输入新密码：</h5><span id="passwordNotice"></span>
        <input id="password2" type="password" onblur="check();"/>
        <div class="clear"></div>
        <div class="sub">
        <input type="submit" value="确定" />
        <input type="reset" value="重置" />
        </div>
    </form>
    <iframe style="display:none;" onLoad="handlBack()" id="handleBack" name="handleBack"></iframe>
</body>
<script type="text/javascript" src="/networkforum/js/myajax.js"></script>
</html>
